import Vue from 'vue';
import Router from 'vue-router';
import element_ui from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

const signin = r => require.ensure([], () => r(require('@/components/admin/signin.vue')), 'signin');
const rightsidebar = r => require.ensure([], () => r(require('@/components/rightsidebar.vue')), 'rightsidebar');
const sidebar = r => require.ensure([], () => r(require('@/components/sidebar.vue')), 'sidebar');
const article = r => require.ensure([], () => r(require('@/components/article.vue')), 'article');
const about = r => require.ensure([], () => r(require('@/components/about.vue')), 'about');
const articleDetail = r => require.ensure([], () => r(require('@/components/articleDetail.vue')), 'articleDetail');
const articleList = r => require.ensure([], () => r(require('@/components/admin/articleList.vue')), 'articleList');
const articleEdit = r => require.ensure([], () => r(require('@/components/admin/articleEdit.vue')), 'articleEdit');
import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';
import axios from 'axios';
import vueParticleLine from 'vue-particle-line';
import 'vue-particle-line/dist/vue-particle-line.css';

Vue.prototype.$req = axios;
Vue.use(Router);
Vue.use(element_ui);
Vue.use(mavonEditor);
Vue.use(vueParticleLine);

export default new Router({
    routes: [
        {
            path: '/',
            components: {
                default: article,
                sidebar: sidebar,
                rightsidebar: rightsidebar
            }
        }, {
            path: '/article',
            components: {
                default: article,
                sidebar: sidebar,
                rightsidebar: rightsidebar
            }
        }, {
            path: '/about',
            components: {
                sidebar: sidebar,
                default: about
            }
        }, {
            path: '/articleDetail/:id',
            components: {
                default: articleDetail,
                sidebar: sidebar
            }
        }, {
            path: '/admin/articleList',
            components: {
                default: articleList,
                sidebar: sidebar
            }
        }, {
            path: '/admin/articleEdit',
            component: articleEdit,
            sidebar: sidebar
        }, {
            path: '/admin/articleEdit/:id',
            component: articleEdit,
            sidebar: sidebar
        }, {
            path: '/admin/signin',
            component: signin
        }
    ]
});
